package trism.game.model {
	import trism.game.Game;
	import trism.game.model.common.CommonItem;
	import trism.game.view.GameView;

	import com.samoiloff.framework.model.AbstractModel;
	import com.samoiloff.util.actions.Actions;

	import flash.events.Event;

	/**
	 * @author Samoiloff  http://samoiloff.com/
	 */
	public class GameModel extends AbstractModel {
		
		public static const INITIALIZED_CHANGED:String = "initializedChanged"; 
		
		private var _commonItem : CommonItem;
		private var _actionsItem : Actions;

		private var _initialized : Boolean;
		
		
		public function GameModel(component : Game, view : GameView) {
			super(component, view);
			
			_commonItem = new CommonItem();
			_actionsItem= new Actions();

			complete();
		}
		
//		private function init(e:Event = null):void {
//			_view.mainMc.removeEventListener(Event.ADDED_TO_STAGE, init);
//			
//			var staticItem:StaticItem = _commonItem.staticItem;
//			staticItem.flashvars.update(view.mainMc.loaderInfo.parameters);
//			staticItem.levels.update(staticItem.levels.getEmbedLevelsXML());
//			
//			complete();
//		}
		

		public function get commonItem() : CommonItem {
			return _commonItem;
		}

		public function get actionsItem() : Actions {
			return _actionsItem;
		}

		public function set initialized(initialized : Boolean) : void {
			_initialized = initialized;
			dispatchEvent(new Event(INITIALIZED_CHANGED));
		}

		public function get initialized() : Boolean {
			return _initialized;
		}
		
		
		
	}
}
